package com.example.demo.service.serviceImpl;

import com.example.demo.entity.Bookshelef;
import com.example.demo.mapper.BookshelefMapper;
import com.example.demo.service.BookshelefService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 书架表(Bookshelef)Service层
 *
 * @author 杨丽辉
 * @since 2021-03-10 11:05:31
 */
@Service
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
public class BookshelefServiceImpl implements BookshelefService {
        @Autowired
        private BookshelefMapper bookshelefMapper;


 /**
     * 通过ID和其他条件查询单条数据
     *
     * @param bookshelef 实例对象
     * @return 实例对象
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
     public Bookshelef queryBookshelefLimit1(Bookshelef bookshelef){
     return  bookshelefMapper.queryBookshelefLimit1( bookshelef);
     }
     
 /**
     * 查询指定行数据
     * @param bookshelef 实例对象
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
  public   List<Bookshelef> queryAllBookshelefByLimit( Bookshelef bookshelef, Integer offset,  Integer limit){
   return bookshelefMapper.queryAllBookshelefByLimit(bookshelef, offset,limit);
  }

  /**
     * 查询数据条数
     * @return 条数
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public int countAllBookshelef(Bookshelef bookshelef){
   return bookshelefMapper.countAllBookshelef( bookshelef);
   }
   /**
     * 通过实体作为筛选条件查询
     *
     * @param bookshelef 实例对象
     * @return 对象列表
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public List<Bookshelef> queryAllBookshelef(Bookshelef bookshelef){
   return bookshelefMapper.queryAllBookshelef(bookshelef);
   }
  /**
     * 新增数据
     *
     * @param bookshelef 实例对象
     * @return 影响行数
     */
     @Override
   @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
    public int insertBookshelef(Bookshelef bookshelef){
    return  bookshelefMapper.insertBookshelef( bookshelef);
    }
  /**
     * 修改数据
     *
     * @param bookshelef 实例对象
     * @return 影响行数
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
     public  int updateBookshelef(Bookshelef bookshelef){
         return bookshelefMapper.updateBookshelef( bookshelef);
     }

    /**
     * 通过主键删除数据
     * @param bookshelfId 主键
     * @return 影响行数
     */
      @Override
  @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public  int deleteBookshelefById(String bookshelfId){
   return  bookshelefMapper.deleteBookshelefById( bookshelfId);
   }
     /**
     * 通过主键列表删除，列表长度不能为0
     * @param list 集合
     * @return 条数
     */
      @Override
  @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
  public  int deleteBookshelefByIds( List<String> list){
    return  bookshelefMapper.deleteBookshelefByIds(  list);
  }
    
       /**
     * 通过主键修改实体列表，列表长度不能为0，注意：当实体属性为null时，对应的列也会别更新为null
     * @param list 集合
     * @return 条数
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public int updateBookshelefBatch( List<Bookshelef> list){
   return  bookshelefMapper.updateBookshelefBatch(list);
   }
    /**
     * 批量其他列,除主键以外的列，列表长度不能为0,字段是空的就置为null
     * @param list 集合
     * @return 条数
     */
      @Override
  @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
 public   int insertBookshelefBatch( List<Bookshelef> list){
 return bookshelefMapper.insertBookshelefBatch( list);
 }
      /**
     * 通过实体非空属性删除
     * @param bookshelef  实体
     * @return 条数
     */
        @Override
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
  public   int deleteBookshelefByEntity( Bookshelef bookshelef){
  return  bookshelefMapper.deleteBookshelefByEntity(  bookshelef);
  }
    /**
     * 通过实体不为空的属性作为筛选条件查询列表
     * @param bookshelef  实体
     * @return list
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public  List<Bookshelef> listBookshelefByEntity(Bookshelef bookshelef){
   return bookshelefMapper.listBookshelefByEntity( bookshelef);
   }

 /**
     * 新增实体属性不为null的列
     * @param bookshelef  实体
     * @return 条数
     */
       @Override
 @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
   public  int insertBookshelefSelect( Bookshelef bookshelef){
      return bookshelefMapper.insertBookshelefSelect( bookshelef);

   }
   
      /**
     * 批量新增新增实体属性不为null的列
     * @param list  实体
     * @return 条数
     */
        @Override
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
  public  int insertBookshelefListSelect( List<Bookshelef> list){

     return bookshelefMapper.insertBookshelefListSelect( list);
      }
     /**
     * 通过实体不为空的属性作为筛选条件查询单个
     * @param bookshelef  实体
     * @return 单个
     */
     @Override
   @Transactional(rollbackFor = {RuntimeException.class, Exception.class})
    public  Bookshelef getBookshelefByEntity(Bookshelef bookshelef){
     return  bookshelefMapper.getBookshelefByEntity(bookshelef);
    }

}

